/*
 * Services.cpp
 *
 */

#include "Service.h"

Service::Service() : id(0), providerId(0) {}

Service::~Service() {}

Service::Service(BigInt id, BigInt providerId, const String& name, const String& description, const String& type):
	id(id), providerId(providerId), name(name), description(description), type(type) {}

Service::Service(const Service& other) {
	id = other.id;
	providerId = other.id;
	name = other.name;
	description = other.description;
	type = other.type;
}

Service& Service::operator =(const Service& other) {
	id = other.id;
	providerId = other.id;
	name = other.name;
	description = other.description;
	type = other.type;
	return *this;
}

BigInt Service::size() const {
	return 3 + 2*sizeof(BigInt) + name.length() + description.length() + type.length();
}

void Service::serialize(ISerializer& serializer) const {
	serializer.serializeUnsignedLongInt(id);
	serializer.serializeUnsignedLongInt(providerId);
	serializer.serializeString(name);
	serializer.serializeString(description);
	serializer.serializeString(type);
}

void Service::unserialize(IUnserializer& unserializer) {
	id = unserializer.unserializeUnsignedLongInt();
	providerId = unserializer.unserializeUnsignedLongInt();
	name = unserializer.unserializeString();
	description = unserializer.unserializeString();
	type = unserializer.unserializeString();
}
